home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
COMMUNIC
/
1303A.ZIP
/
ETCH.BSC
< prev
next >
Wrap
Text File
|
1989-02-01
|
2KB
|
36 lines
\\ Sample script to turn BOYAN into an Etch-a-Sketch!
\\ This script is fairly advanced, demonstrating the following techniques:
\\ 1. Cursor movement and screen control
\\ 2. Saving the beeps & bells toggle for later restoring
\\ 3. Reading and testing user input
\\ 4. Separating a script into blocks: START, DRAW, and EXIT
|START
\ZS \\ clears screen
\ST[ Welcome to BOYAN Etch-A-Sketch! ] \\ status message
\SV3[%BB] \\ saves current beeps&bells value in variable 3
\BB- \\ turns beeps&bells off
\KO[60] \\ set keyboard timeout to 60 seconds
\GX[40]\GY[12] \\ start in the middle of the screen (40,12)
|DRAW
\DM1,1[<I>=up│<J>=left│<K>=right│<M>=down│<X>=exit ]
\DM1[│ X-position = %XP │ Y-position = %YP ] \\ display status on line 1
\KV1_[Your Etch-a-sketch command? ] \\ get char input from keybd
\DM%XP,%YP[ ] \\ display a space at current x,y cursor posn
\IV1+I[\RY[-1]] \\ move up if input="I"
\IV1+J[\RX[-1]] \\ move left if input="J"
\IV1+K[\RX[1]] \\ move right if input="K"
\IV1+M[\RY[1]] \\ move down if input="M"
\IV1+X[\GB[EXIT]] \\ go to "EXIT" block if input="X"
\DM%XP,%YP[▒] \\ display a shaded block at cursor position
\GB[DRAW] \\ loop back for more input!
|EXIT
\IE+%V3,ON[\BB+] \\ turn beeps&bells back on if they were on before
\GX[1]\GY[24] \\ leave cursor on bottom line of screen